"""
@-*- coding: utf-8 -*-
@ python: 3.12.3
@ 创建者: JacksonCode
@ 创建时间: 2025/8/29
"""
import subprocess
from functools import partial
subprocess.Popen = partial(subprocess.Popen, encoding="utf-8")


import requests
import json
import execjs

js_compile = open("1.mainfunc.js").read()
js_code = execjs.compile(js_compile)

headers = {
    "Accept": "*/*",
    "Accept-Language": "zh-CN,zh;q=0.9",
    "Cache-Control": "no-cache",
    "Connection": "keep-alive",
    "Content-Type": "application/json",
    "Origin": "https://dewu.com",
    "Pragma": "no-cache",
    "Referer": "https://dewu.com/",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-site",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36",
    "sec-ch-ua": "\"Not;A=Brand\";v=\"99\", \"Google Chrome\";v=\"139\", \"Chromium\";v=\"139\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "traceparent": "00-f5dddb1468b15b3fa06bc19e88f3f5d9-ff588590b663916e-01"
}
cookies = {
    "sensorsdata2015jssdkcross": "%7B%22distinct_id%22%3A%22198eebd02c91f2-07abca5782b438-26011051-1204049-198eebd02ca972%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22identities%22%3A%22eyIkaWRlbnRpdHlfY29va2llX2lkIjoiMTk4ZWViZDAyYzkxZjItMDdhYmNhNTc4MmI0MzgtMjYwMTEwNTEtMTIwNDA0OS0xOThlZWJkMDJjYTk3MiJ9%22%2C%22history_login_id%22%3A%7B%22name%22%3A%22%22%2C%22value%22%3A%22%22%7D%2C%22%24device_id%22%3A%22198eebd02c91f2-07abca5782b438-26011051-1204049-198eebd02ca972%22%7D"
}
url = "https://app.dewu.com/api/v1/h5/commodity-pick-interfaces/pc/pick-rule-result/feeds/info"
data = {
    # "sign": "f2b6b4c666227d52fdadf251f307445d",
    "pickRuleId": 644479,
    "pageNum": 1,
    "pageSize": 24,
    "filterUnbid": True,
    "showCspu": True
}

sign = js_code.call("getSign",data)
data["sign"] = sign

data = json.dumps(data, separators=(',', ':'))
response = requests.post(url, headers=headers, cookies=cookies, data=data)

print(response.text)